package cn.tedu.com.enums;

import java.io.Serializable;

/**
 * <p>
 *
 * </p>
 *
 * @author zhaoyue1
 * @Description
 * @since 2021-05-14
 */
public enum UserRole  {
    USER_Manager(0,"管理"),
    USER_LEADER(1,"领导"),
    USER_WORKER(2,"员工"),
    User_Other(3,"其他"),
    ;


    private Integer role;
    private String roleName;

     UserRole(Integer role,String roleName){
        this.role=role;
        this.roleName=roleName;
    }


    public Integer getRole() {
        return role;
    }

    public String getRoleName() {
        return roleName;
    }

    public static UserRole getEnum(Integer code){
        UserRole[] values = values();
        if(values.length>0){
            for(UserRole ur:values){
                if(code.equals(ur.getRole())){
                    return  ur;
                }
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return "UserRole{" +
                "role=" + role +
                ", roleName='" + roleName + '\'' +
                '}';
    }
}
